#include "loger.hpp"
#include "asio.hpp"

#include <vector>

using asio::ip::tcp;


int main(int argc, char const* argv[])
{
    asio::io_context io_context;
    tcp::endpoint ep(tcp::v4(), 9000);

    tcp::socket socket(io_context);
    asio::error_code error;
    socket.connect(ep, error);
    if(error) {
        sl::loger::error("connect false:{}", error.value());
    }

    std::string msg = "tcp echo message";
    socket.send(asio::buffer(msg));

    std::vector<char> data(1024);
    std::size_t length = socket.read_some(asio::buffer(data));
    if(length != msg.size()) {
        sl::loger::error("recv error. length: {}", length);
        return __LINE__;
    }
    sl::loger::info("recv data:{}", length);
    sl::loger::info("SyraLink connector start");
    return 0;
}
